AppEvents.js ➔ ... ➔ event   A
last analyzed

Complexity

Conditions 1
Paths 2

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 11
rs 9.4285
1
var AppEvents = {}
2
3
function factory (name, defaults) {
4
  defaults = defaults || {}
5
  var fullName = 'Application.' + name
6
  var event = function (data) {
7
    var self = this
8
    data = data || {}
9
    Object.defineProperty(this, 'name', {value: fullName, writable: false})
10
    Object.keys(defaults).forEach(function (key) {
11
      self[key] = defaults[key]
12
    })
13
    Object.keys(data).forEach(function (key) {
14
      self[key] = data[key]
15
    })
16
  }
17
  Object.defineProperty(event, 'name', {value: fullName, writable: false})
18
  event._properties = Object.keys(defaults)
19
  AppEvents[name] = event
20
}
21
22
factory('CallAlerting', {
23
  call: {},
24
  callerid: null,
25
  customData: '',
26
  destination: '',
27
  displayName: '',
28
  fromURI: '',
29
  headers: {},
30
  toURI: ''
31
})
32
factory('HttpRequest', {content: '', method: 'POST', path: '/'})
33
factory('Started', {accessURL: ''})
34
factory('Terminating')
35
factory('Terminated')
36
37
module.exports = {
38
  AppEvents: AppEvents
39
}
40